
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <GL/glut.h>
#include <GL/gl.h>
#include <iostream>
#include <fstream>
#include <string>
#include <math.h>

#include "rigidbody.h"
#include "model.h"

unsigned int RigidBody::next_id = 0;

RigidBody::RigidBody(){
	rb_model = new Model();
	r = Vector4(0.f, 0.f, 0.f);
	v = Vector4(0.f, 0.f, 0.f);
}

bool RigidBody::load(std::string filename)
{
	if(filename.find(".obj") != std::string::npos)
		rb_model->loadObj(filename);
		return true;
	//else if(filename.find(".egg") != std::string::npos)
	//	rb_model.loadEgg(filename);
	//	return true;
	return false;
}

void RigidBody::setPos(float x, float y, float z)
{
	r[0] = x;
	r[1] = y;
	r[2] = z;
}

void RigidBody::setColors(int num, float **colors)
{
	rb_model->setColors(num, colors);
}


void RigidBody::draw()
{
	glTranslatef(r[0], r[1], r[2]);
	rb_model->draw();
	glTranslatef(-r[0], -r[1], -r[2]);
}